package com.glsc.ngateway.platform.domain.costallocation;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.glsc.ngateway.platform.dto.AllDepDto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * @author guoj
 * @description: 成本分摊-业务系统信息
 * @date 2024/7/18 15:16
 */
@Data
@Entity
@Table(name = "t_busisystem_info")
@AllArgsConstructor
@NoArgsConstructor
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class BusiSystemInfo {

    @ApiModelProperty(value = "id")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "l_id", columnDefinition = "int(11) comment '系统ID'")
    private Long id;
    @ApiModelProperty(value = "系统名称")
    @Column(name = "vc_system_name", columnDefinition = "varchar(50) comment '系统名称'")
    private String systemName;

    @ApiModelProperty(value = "系统编号")
    @Column(name = "vc_system_classno", columnDefinition = "varchar(50) comment '系统编号'")
    private String systemClassNo;
    @ApiModelProperty(value = "责任人oa账户")
    @Column(name = "vc_system_user_id", columnDefinition = "varchar(500) comment '责任人 逗号分割 多个'")
    private String systemUserId;

    @ApiModelProperty(value = "系统大类")
    @Column(name = "vc_main_class", columnDefinition = "varchar(10) comment '系统大类'")
    private String mainClass;

    @ApiModelProperty(value = "系统小类")
    @Column(name = "vc_system_class", columnDefinition = "varchar(10) comment '系统小类'")
    private String systemClass;

    @ApiModelProperty(value = "操作人")
    @Column(name = "vc_operator", columnDefinition = "varchar(50) comment '操作人'")
    private String operator;
    //部门选择
    @ApiModelProperty(value = "全部部门信息")
    @Column(name = "vc_special_dep", columnDefinition = "json comment '特殊全部部门信息'")
    private String specilaDep;

    @ApiModelProperty(value = "更新时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @org.hibernate.annotations.UpdateTimestamp
    @Column(name = "dt_update_time", columnDefinition = "datetime comment '更新时间'")
    protected LocalDateTime updateTime;

    @ApiModelProperty(value = "成本分摊列表")
    @Transient
    private List<DepCostAllocation>  depCostAllocationList;
    @ApiModelProperty(value = "责任人名称")
    @Transient
    private String systemUserName;
    @ApiModelProperty(value = "应用类别列表")
    @Transient
    private List<SystemComponentCategory> systemComponentCategoryList;
    @ApiModelProperty(value = "选中部门信息-返回前端")
    @Transient
    private List<AllDepDto> allDepDtoList;

    @ApiModelProperty(value = "未选中部门信息-返回前端")
    @Transient
    private List<AllDepDto> unCheck;

}
